#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main1()
{
	string str1 = "13221";
	int IS = 0;

	for (int i = 0; i < str1.size(); i++)
	{
		IS += str1[i] - '0';
		cout << IS;
	}

	return 0;
}

int main2() {
    string str1, str2; cin >> str1;
    int ISBN = 0, j = 1;
    for (int i = 0; i < str1.size() - 1; i++)
    {
        if (str1[i] == '-')
        {
            str2 += str1[1];
        }
        else
        {
            ISBN += (str1[i] - '0') * j;
            j++;
            str2 += str1[i];
        }
    }

    char c;
    ISBN %= 11; if (ISBN == 10) { c = 'X'; }
    else { c = ISBN + '0'; }

    auto rit = str1.rbegin();
    if (c == *rit) { cout << "Right" << endl; }
    else { cout << (str2 += c) << endl; }

    return 0;
}

class Solution {
public:
    int n, m;
    int dx[4] = { 0, 0, 1, -1 };
    int dy[4] = { 1, -1, 0, 0 };
    int memo[1010][1010];

    int dfs(vector<vector<int> >& matrix, int i, int j) {
        if (memo[i][j] != -1) {
            return memo[i][j];
        }
        int len = 1;
        for (int k = 0; k < 4; k++) {
            int x = i + dx[k], y = j + dy[k];
            if (x >= 0 && x < n && y >= 0 && y < m
                && matrix[x][y] > matrix[i][j]) {
                len = max(len, dfs(matrix, x, y) + 1);
            }
        }
        memo[i][j] = len;
        return len;
    }

    int solve(vector<vector<int> >& matrix) {
        n = matrix.size();
        m = matrix[0].size();
        int _max = 1;
        memset(memo, -1, sizeof(memo));

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                _max = max(_max, dfs(matrix, i, j));
            }
        }

        return _max;
    }
};

int main()
{
    int n = 2, m = 3;
    vector<vector<char>> v(n, vector<char>(m, '0'));

 

    return 0;

}